package org.colafries.common.utils;

import java.util.Random;

/**
 * @author Ann
 * @version v1.0
 * @ClassName CommonUtil
 * @Description
 * @date Created in 2024/9/3
 **/
public class CommonUtil {


    private static final Random random = new Random();

    // 生成唯一编码的方法
    public static String generateUniqueIdentifier() {
        char[] identifier = new char[2];
        for (int i = 0; i < 2; i++) {
            if (random.nextBoolean()) {
                // 生成数字字符 '0'-'9'
                identifier[i] = (char) ('0' + random.nextInt(10));
            } else {
                // 生成字母字符 'a'-'z'
                identifier[i] = (char) ('a' + random.nextInt(26));
            }
        }
        return new String(identifier);
    }
}
